﻿using System;
using System.Collections.Generic;
using System.Text;
using Core.Parser.ASN1Parser.Nodes;
using Core.Model;
using Core.Exceptions;

namespace Core.Parser.ASN1Parser.Builders
{
    internal class ProgramBuilder
    {
        internal static void Build(TaggedNode node, Program program, Group group)
        {
            IngredientBuilder.Build(node, program, group);

            TaggedNode e;

            if ((e = node[ASN1ContextCodes.C_NAME]) != null)
                program.Name = e.First.StringValue;
            else
                throw new OpenMhegException("Missing Node");

            if ((e = node[ASN1ContextCodes.C_INITIALLY_AVAILABLE]) != null)
                program.InitiallyAvailable = e.First.BoolValue;
            
        }
    }
}
